﻿
@{
    ViewBag.Title = "MedicalSkillQuery";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
        .form .formTitle {
            position: relative;
            left: 0px;
            text-align: right;
            white-space: nowrap;
            font-weight: normal;
            width: 60px;
            padding-right: 10px;
            padding-left: 5px;
        }
    </style>
<form name="form1">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle" id="thshrq" >执行时间：</th>
                <td class="formValue" colspan="3" style="width:340px">
                    <input id="txtkssj" type="text" class="form-control input-wdatepicker formClearIgnore" style="width: 42%; float: left;" value="@DateTime.Now.ToString("yyyy-MM-dd 00:00:00")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                    <span style="margin-left: 2%; float: left;">—</span>
                    <input id="txtjssj" type="text" class="form-control input-wdatepicker formClearIgnore" style="width: 41%; float: left; margin-left: 2%;" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                </td>
                <th class="formTitle">患者类型：</th>
                <td class="formValue">
                    <select class="form-control" id="hzlx">
                        <option value="qb" selected>全部</option>
                        <option value="mz">门诊</option>
                        <option value="zy">住院</option>
                    </select>
                </td>
                <th class="formTitle">费用类型：</th>
                <td class="formValue">
                    <select class="form-control" id="fylx">
                        <option value="qb" selected>全部</option>
                        <option value="jy">检查</option>
                        <option value="jc">检验</option>
                    </select>
                </td>
                <th class="formTitle">申请单类型：</th>
                <td class="formValue">
                    <select class="form-control" id="sqdlx">
                        <option value="" selected>全部</option>
                    </select>
                </td>

            </tr>
            <tr>
                <td class="formValue" colspan="3" >
                    <input id="txt_keyword" name="txt_keyword" type="text" class="form-control" placeholder="请输入患者姓名/就诊号/身份证号/申请单号" />
                </td>
                <td class="formValue" >
                    <input type="button" id="btn_search" class="btn btn-primary btn-md" style="margin-left: 10px; width: 40px;" value="查询" />
                </td>
                <th></th>
                <td></td>
                <th></th>
                <td></td>
                <th></th>
                <td></td>
            </tr>
        </table>
    </div>
    <div class="gridPanel">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</form>
<script>
    $(function () {
        //浏览器窗口调整大小时重新加载jqGrid的宽
        $(window).resize(function () {
            initLayout("MyTabGrid");
        });
        
        gridListData();
    });
    
    function gridListData() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            postData: getSearchPostData(),
            height: $(window).height() - 160,
            url: "@Url.Action("GetJyjcExecRecordJson")",
            colModel: [
                {
                    label: '患者类型', name: 'hzlx', width: 60, align: 'center', formatter: function (val) {
                        return val=="1"?"门诊":"住院"
                    }
                },
                { label: '就诊号/住院号', name: 'mzzyh', width: 90, align: 'center' },
                { label: '患者姓名', name: 'hzxm', align: 'center', width: 80 },
                { label: '身份证', name: 'zjh', align: 'center', width: 120 },
                {
                    label: '费用类型', name: 'fylx', align: 'center', width: 80, formatter: function (val) {
                        if(val=="4" ||val=="6")
                            return "检验"
                        if(val=="5" ||val=="7")
                            return "检查"
                    }
                },
                { label: '申请单号', name: 'sqdh', align: 'center', width: 120 },
                { label: '申请单类型', name: 'sqdlx', align: 'center', width: 70 },
                { label: '项目名称', name: 'ztmc', width: 90, align: 'center' },
                { label: '规格', name: 'gg', width: 50, align: 'center' },
                { label: '单位', name: 'dw', width: 50, align: 'center' },
                { label: '费用数量', name: 'sl', width: 50, align: 'center' },
                { label: '金额', name: 'je', width: 50, align: 'center' },
                { label: '记账人', name: 'jzr', width: 80, align: 'center' },
                { label: '记账时间', name: 'kdrq', width: 120, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                { label: '开单科室', name: 'kdksmc', width: 100, align: 'center' },
                { label: '开单医生', name: 'kdysmc', width: 100, align: 'center' },
                { label: '执行人', name: 'zxr', width: 80, align: 'center' },
                { label: '执行时间', name: 'zxrq', width: 120, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                { label: '执行科室', name: 'zxksmc', width: 100, align: 'center' },
            ],
            pager: "#gridPager",
            sortname: " zxrq asc",
            viewrecords: true
        });

        $("#btn_search").click(function () {
            btn_search();
        });
    }
    function btn_search()
    {
        $('#gridList').jqGrid("clearGridData");//先清空明细
        $("#gridList").jqGrid('setGridParam', {
            postData: getSearchPostData(),
            url: '@Url.Action("GetJyjcExecRecordJson")'
        }).trigger('reloadGrid');
    }

    function getSearchPostData() {
        var keyword = $("#txt_keyword").val();
        var kssj = $("#txtkssj").val();
        var jssj = $("#txtjssj").val();
        var hzlx = $("#hzlx").val();
        var fylx = $("#fylx").val();
        var sqdlx = $("#sqdlx").val();
        return {
            keyword: keyword, kssj: kssj, jssj: jssj, hzlx: hzlx, fylx: fylx, sqdlx: sqdlx
        };
    };

</script>